﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace WpfApplication2
{
    /// <summary>
    /// Interaction logic for HostServiceProperty1.xaml
    /// </summary>
    public partial class HostServiceProperty1 : UserControl
    {
        Entities.HostedServiceProperty Serviceproperty;
        public HostServiceProperty1(Entities.HostedServiceProperty _ServiceProperty)
        {
            InitializeComponent();
            Serviceproperty = _ServiceProperty;
            this.Loaded += new RoutedEventHandler(HostServiceProperty1_Loaded);

        }

        void HostServiceProperty1_Loaded(object sender, RoutedEventArgs e)
        {
            TextBoxServiceName.Text = Serviceproperty.ServiceName;
            TextBoxUrl.Text = Serviceproperty.Url;
            TextBoxDescription.Text = Serviceproperty.Description;

            //byte[] encodedDataAsBytes = System.Convert.FromBase64String(Serviceproperty.Label);
            string LabelValue = Serviceproperty.Label;// System.Text.ASCIIEncoding.ASCII.GetString(encodedDataAsBytes);



            TextBoxLabel.Text = LabelValue;
            TextBoxLocation.Text = Serviceproperty.Location;
            TexBoxAffinityGp.Text = Serviceproperty.AffinityGroup;

            //for (int i = 0; i < Serviceproperty.DeploymentPropertyList.Count; i++)
            //{
            //    if (Serviceproperty.DeploymentPropertyList[i].DeploymentSlot.Equals("Staging"))
            //    {
            //        DataGridStagingDeployment.ItemsSource = Serviceproperty.DeploymentPropertyList[i].RoleInstanceList;
            //    }
            //    else
            //    {
            //        DataGridProductionDeployment.ItemsSource = Serviceproperty.DeploymentPropertyList[i].RoleInstanceList;
            //    }


            //}
            DataGridDeployment.ItemsSource = Serviceproperty.DeploymentPropertyList;

        }

        
    }
}
